package string.builder.demo;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-20
 */


public class Test {
    public static void main(String[] args) {
        String s  = "abc";


        StringBuilder tmp = new  StringBuilder();
        tmp.append(s);
        System.out.println(s);
        for (int i = 0; i < 100000; i++) {
            tmp.append(i);
        }
        s = tmp.toString();
        //System.out.println(s);

        //直接相加，更耗时
    /*     for (int i = 0; i < 100000; i++) {
            s += i;
        }*/

        System.out.println("字符串相加结束");
    }
}
